#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <sys/mman.h>
#include <fcntl.h>

int main(int argc, char **argv)
{


   int fp = open("a.txt", O_RDWR | O_CREAT, 0644);
   
   if (fp == -1)
   {
      perror("FILE ERROR");
      exit(0);
   }

   // ftruncate(fp, 4096);
   char *fpt = mmap(NULL, 4096, PROT_WRITE | PROT_READ, MAP_SHARED, fp, 0);
   if (fpt == MAP_FAILED)
   {
      perror("mmap error");
      exit(0);
   }
   printf(" %s \n", fpt);
   printf(" %s \n", fpt);

   return 0;
}